package com.redhipps.hips.client.model;

import javax.jdo.annotations.Extension;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.NotPersistent;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;


@PersistenceCapable(identityType = IdentityType.APPLICATION)
public abstract class Model {

  @PrimaryKey
  @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
  @Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value = "true") 
  private String key;

  @Deprecated
  @NotPersistent
  private PythonDatastoreKey pythonKey;

  public Model() {}

  @Deprecated
  public Model(PythonDatastoreKey key) {
    this.pythonKey = key;
  }

  @Deprecated
  public PythonDatastoreKey key() {
    return pythonKey;
  }

  public Key getKey() {
    return new Key(key);
  }

  public void setKey(Key key) {
    this.key = key.getValue();
  }

}
